package com.zyp.messageboard.util;

import java.util.Arrays;
import java.util.List;

public class SensitiveWordUtil {

    private static final List<String> SENSITIVE_WORDS = Arrays.asList(
            "cnm", "sb", "傻逼");

    /**
     * 检测并替换敏感词汇
     * @param text 输入文本
     * @return 替换后的文本
     */
    public static String replaceSensitiveWords(String text) {
        if (text == null) {
            return null;
        }
        String result = text;
        for (String word : SENSITIVE_WORDS) {
            if (result.contains(word)) {
                result = result.replaceAll(word, "***");
            }
        }
        return result;
    }
}
